﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="KOLASeaduseSate", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(KOLASeaduseSate))]
    public class KOLASeaduseSateSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IKOLASeaduseSate clazz;
        
        public KOLASeaduseSateSerializer(IKOLASeaduseSate clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.Loige!=null) {
                Writer.WriteStartElement("Loige");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Loige))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ParagLiik!=null) {
                Writer.WriteStartElement("ParagLiik");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.ParagLiik))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Paragrahv!=null) {
                Writer.WriteStartElement("Paragrahv");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Paragrahv))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Punkt!=null) {
                Writer.WriteStartElement("Punkt");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Punkt))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Seadustik!=null) {
                Writer.WriteStartElement("Seadustik");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "int");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.Seadustik))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Loige") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Loige = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Loige")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ParagLiik") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ParagLiik = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("ParagLiik")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Paragrahv") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Paragrahv = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Paragrahv")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Punkt") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Punkt = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Punkt")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Seadustik") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Seadustik = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("Seadustik")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
